package com.factory.demo1.main;

import com.factory.demo1.ads.ChicagoPizzaStore;
import com.factory.demo1.ads.NYPizzaStore;
import com.factory.demo1.ads.Pizza;
import com.factory.demo1.ads.PizzaStore;

/**
 * 工厂模式：定义了一个创建对象的接口，但由子类决定要实例化的类是哪一个。工厂方法让类把实例化推迟到子类
 * 
 * @author dell
 * 
 */
public class PizzaTestDrive {

	public static void main(String[] args) {
		PizzaStore nyStore = new NYPizzaStore();
		PizzaStore chicagoStore = new ChicagoPizzaStore();

		Pizza pizza = nyStore.orderPizza("cheese");
		System.out.println("Ethan ordered a " + pizza.getName() + "\n");

		pizza = chicagoStore.orderPizza("cheese");
		System.out.println("Joel ordered a " + pizza.getName() + "\n");
	}

}
